<%-- 
    Document   : dashboardAccount
    Created on : Jan 17, 2013, 10:51:49 PM
    Author     : KAKAIT
--%>

<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="model.BillImp"%>
<%@page import="model.entity.Bill"%>
<%@page import="java.util.List"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="model.entity.Account"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="col-main" id="ves-col-main">
						<!-- main content -->
<%
    Account ac = (Account)session.getAttribute("acc");
%>												<div class="my-account"><div class="dashboard">
    <div class="page-title">
        <h1>My Dashboard</h1>
    </div>
        <div class="welcome-msg">
    <p class="hello"><strong>Hello, <%= ac.getFirstname() +" "+ ac.getLastname() %>!</strong></p>
    <p>From your My Account Dashboard you have the ability to view a snapshot of your recent account activity and update your account information. Select a link below to view or edit information.</p>
</div>
     <%
     BillImp bip = new BillImp();
     List<Bill> bil = bip.Listbillbyusername(ac.getUsername()); 
     if(bil!=null)
     {
    %>                                                                                                   
    <div class="box-account box-recent">
        <div class="box-head">
        <h2>Recent Orders</h2>
        </div>
        <table id="my-orders-table" class="data-table">
            <colgroup>
                <col>
                <col>
                <col>
                <col width="1">
                <col width="1">
                <col width="1">
            </colgroup>
            <thead>
                <tr class="first last">
                    <th>Order #</th>
                    <th>Date</th>
                    <th>Ship To</th>
                    <th><span class="nobr">Order Total</span></th>
                    <th>Status</th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <%
                boolean temp = true;
                for(int i = 0; i< bil.size(); i++)
                {
                %>
                <tr class="first last odd">
                    <td><%= bil.get(i).getBillid() %></td>
                    <td><span><%= bil.get(i).getDatepurchase() %></span></td>
                    <td><%= bil.get(i).getUsername() %></td>
                    <td><span class="price">$<%= bil.get(i).getTotalamount() %></span></td>
                    <td><em><%= bil.get(i).isStatus() == true ? "payment" : "Pending" %></em></td>
                    <td class="a-center last">
                        <span class="nobr">
                            <a href="<c:url value="/vieworders"><c:param name="billid" value="<%= bil.get(i).getBillid() %>"/><c:param name="datepurchase" value="<%= bil.get(i).getDatepurchase() %>"/></c:url>">View Order</a>
                    </td>
                </tr>
                <%}%>
            </tbody>
        </table>
    <script type="text/javascript">
        decorateTable('my-orders-table');
        window.document.title ="My Account Dash Board";
    </script>
    </div>  
            
  <%}%>
        <div class="box-account box-info">
        <div class="box-head">
            <h2>Account Information</h2>
        </div>
                        <div class="col2-set">
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h3>Contact Information</h3>
                <a href="<c:url value="/changepass"/>">Change Password</a>
            </div>
            <div class="box-content">
                <p>
                    <%= ac.getFirstname().toString()+" "+ ac.getLastname().toString() %><br>
                    <%= ac.getEmail().toString() %><br>
                    <strong style="font-size: small;">Credit : $<%= ac.getCredit() %></strong>
                </p>
            </div>
        </div>
    </div>
        <div class="col-2">
        <div class="box">
            <div class="box-title">
                <h3>Address</h3>
                <a href="<c:url value="/editaccount"/>">Edit</a>
            </div>
            <div class="box-content">
             <div class="col-1">
                <h4>Default Address</h4>
                <address>
                    <%= ac.getFirstname() +" "+ ac.getLastname() %><br>
                    <%= ac.getStreet() %><br>
                    <%= ac.getCity() %> <%= ac.getState_province().toString()!= null ? ac.getState_province() : "" %></br>
                    <%= ac.getCountry() %>.<br>
                    T: <%= ac.getMobile() %><br>
                    
                </address>
            </div>
            </div>
        </div>
                    </div>
    </div>
      
    </div>
        </div></div>						<!-- end main content -->		
						
												
					</div>


